<?php
$sql = "
CREATE TABLE IF NOT EXISTS `ims_weisrc_dish_cardlog` (
            `id` int(10) NOT NULL AUTO_INCREMENT,
            `weid` int(10) NOT NULL DEFAULT '0' COMMENT '公众号id',
            `from_user` varchar(50) NOT NULL COMMENT '',
            `title` varchar(200) NOT NULL COMMENT '标题',
            `type` tinyint(1) NOT NULL DEFAULT '1' COMMENT '业务类型-用户充值:1,消费:2',
            `operationtype` tinyint(1) NOT NULL DEFAULT '1' COMMENT '积分操作类型 增加:1  扣除:0',
            `price` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '消费金额',
            `dateline` int(10) NOT NULL DEFAULT '0',
            `remark` text NOT NULL DEFAULT '' COMMENT '备注',
            PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `ims_weisrc_dish_cardprivilege` (
            `id` int(10) NOT NULL AUTO_INCREMENT,
            `weid` int(10) NOT NULL DEFAULT '0' COMMENT '公众号id',
            `storeid` int(10) unsigned NOT NULL,
            `title` varchar(50) NOT NULL DEFAULT '' COMMENT '特权名称',
            `desc` varchar(100) NOT NULL DEFAULT '' COMMENT '特权名称',
            `icon` tinyint(1) NOT NULL DEFAULT '1',
            `url` varchar(500) NOT NULL DEFAULT '' COMMENT '网址',
            `dateline` int(10) NOT NULL DEFAULT '0',
          PRIMARY KEY (`id`)
        ) ENGINE=MyISAM DEFAULT CHARSET=utf8;


      CREATE TABLE IF NOT EXISTS  `ims_weisrc_dish_cardsetting` (
            `id` int(10) NOT NULL AUTO_INCREMENT,
            `weid` int(10) NOT NULL DEFAULT '0' COMMENT '公众号id',
            `title` varchar(200) NOT NULL DEFAULT '',
            `rule` text NOT NULL COMMENT '',
            `opencardcredit` int(10) NOT NULL DEFAULT '0' COMMENT '开卡奖励消费积分',
            `sendcredit` int(10) NOT NULL DEFAULT '0' COMMENT '推荐用户奖励消费积分',
            `startmoney` int(10) NOT NULL DEFAULT '0' COMMENT '多少金额可能抵扣',
            `maxcredit` int(10) NOT NULL DEFAULT '0' COMMENT '每次消费最多可以使用几个积分',
            `status` tinyint(1) NOT NULL DEFAULT '0',
            `dateline` int(10) NOT NULL DEFAULT '0' COMMENT '领卡时间',
            PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `ims_weisrc_dish_cardprice` (
    `id` int(10) NOT NULL AUTO_INCREMENT,
    `weid` int(10) NOT NULL DEFAULT '0' COMMENT '公众号id',
    `storeid` int(10) unsigned NOT NULL,
    `title` varchar(50) NOT NULL DEFAULT '' COMMENT '',
    `daycount` int(10) NOT NULL DEFAULT '0',
    `price` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '',
    `icon` tinyint(1) NOT NULL DEFAULT '1',
    `url` varchar(500) NOT NULL DEFAULT '' COMMENT '网址',
    `dateline` int(10) NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;


CREATE TABLE IF NOT EXISTS  `ims_weisrc_dish_card` (
            `id` int(10) NOT NULL AUTO_INCREMENT,
            `storeid` int(10) unsigned NOT NULL,
            `from_user` varchar(50) NOT NULL DEFAULT '',
            `weid` int(10) NOT NULL DEFAULT '0' COMMENT '公众号id',
            `uid` int(10) NOT NULL DEFAULT '0' COMMENT '用户id',
            `cardpre` varchar(10) NOT NULL DEFAULT '',
            `cardno` int(10) NOT NULL DEFAULT '0' COMMENT '会员卡号',
            `cardnumber` varchar(50) NOT NULL DEFAULT '',
            `headimgurl` varchar(500) NOT NULL DEFAULT '' COMMENT '头像',
            `nickname` varchar(50) NOT NULL DEFAULT '' COMMENT '',
            `password` varchar(200) NOT NULL DEFAULT '' COMMENT '登录密码',
            `coin` decimal(11,2) NOT NULL DEFAULT '0.00' COMMENT '余额',
            `balance_score` int(10) NOT NULL DEFAULT '0' COMMENT '剩余积分',
            `total_score` int(10) NOT NULL DEFAULT '0' COMMENT '总积分',
            `spend_score` int(10) NOT NULL DEFAULT '0' COMMENT '消费积分',
            `sign_score` int(10) NOT NULL DEFAULT '0' COMMENT '签到积分',
            `money` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '总消费金额',
            `carnumber` varchar(100) NOT NULL DEFAULT '' COMMENT '车牌号码',
            `status` tinyint(1) NOT NULL DEFAULT '0',
            `updatetime` int(10) NOT NULL DEFAULT '0' COMMENT '更新时间',
            `lasttime` int(10) NOT NULL DEFAULT '0' COMMENT '到期时间',
            `dateline` int(10) NOT NULL DEFAULT '0' COMMENT '领卡时间',
            PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `ims_weisrc_dish_storecardlog` (
            `id` int(10) NOT NULL AUTO_INCREMENT,
            `weid` int(10) NOT NULL DEFAULT '0' COMMENT '公众号id',
            `storeid` int(10) unsigned NOT NULL,
            `from_user` varchar(50) NOT NULL COMMENT '',
            `title` varchar(200) NOT NULL COMMENT '标题',
            `type` tinyint(1) NOT NULL DEFAULT '1' COMMENT '业务类型-用户充值:1,消费:2',
            `operationtype` tinyint(1) NOT NULL DEFAULT '1' COMMENT '积分操作类型 增加:1  扣除:0',
            `price` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '消费金额',
            `dateline` int(10) NOT NULL DEFAULT '0',
            `remark` text NOT NULL DEFAULT '' COMMENT '备注',
            PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;


CREATE TABLE IF NOT EXISTS `ims_weisrc_dish_storecardprivilege` (
            `id` int(10) NOT NULL AUTO_INCREMENT,
            `weid` int(10) NOT NULL DEFAULT '0' COMMENT '公众号id',
            `storeid` int(10) unsigned NOT NULL,
            `title` varchar(50) NOT NULL DEFAULT '' COMMENT '特权名称',
            `desc` varchar(100) NOT NULL DEFAULT '' COMMENT '特权名称',
            `icon` tinyint(1) NOT NULL DEFAULT '1',
            `url` varchar(500) NOT NULL DEFAULT '' COMMENT '网址',
            `dateline` int(10) NOT NULL DEFAULT '0',
          PRIMARY KEY (`id`)
        ) ENGINE=MyISAM DEFAULT CHARSET=utf8;

        CREATE TABLE IF NOT EXISTS `ims_weisrc_dish_storecardprice` (
            `id` int(10) NOT NULL AUTO_INCREMENT,
            `weid` int(10) NOT NULL DEFAULT '0' COMMENT '公众号id',
            `storeid` int(10) unsigned NOT NULL,
            `title` varchar(50) NOT NULL DEFAULT '' COMMENT '',
            `daycount` int(10) NOT NULL DEFAULT '0',
            `price` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '',
            `icon` tinyint(1) NOT NULL DEFAULT '1',
            `url` varchar(500) NOT NULL DEFAULT '' COMMENT '网址',
            `dateline` int(10) NOT NULL DEFAULT '0',
          PRIMARY KEY (`id`)
        ) ENGINE=MyISAM DEFAULT CHARSET=utf8;


CREATE TABLE IF NOT EXISTS  `ims_weisrc_dish_storecard` (
            `id` int(10) NOT NULL AUTO_INCREMENT,
            `storeid` int(10) unsigned NOT NULL,
            `from_user` varchar(50) NOT NULL DEFAULT '',
            `weid` int(10) NOT NULL DEFAULT '0' COMMENT '公众号id',
            `uid` int(10) NOT NULL DEFAULT '0' COMMENT '用户id',
            `cardpre` varchar(10) NOT NULL DEFAULT '',
            `cardno` int(10) NOT NULL DEFAULT '0' COMMENT '会员卡号',
            `cardnumber` varchar(50) NOT NULL DEFAULT '',
            `headimgurl` varchar(500) NOT NULL DEFAULT '' COMMENT '头像',
            `nickname` varchar(50) NOT NULL DEFAULT '' COMMENT '',
            `password` varchar(200) NOT NULL DEFAULT '' COMMENT '登录密码',
            `coin` decimal(11,2) NOT NULL DEFAULT '0.00' COMMENT '余额',
            `balance_score` int(10) NOT NULL DEFAULT '0' COMMENT '剩余积分',
            `total_score` int(10) NOT NULL DEFAULT '0' COMMENT '总积分',
            `spend_score` int(10) NOT NULL DEFAULT '0' COMMENT '消费积分',
            `sign_score` int(10) NOT NULL DEFAULT '0' COMMENT '签到积分',
            `money` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '总消费金额',
            `carnumber` varchar(100) NOT NULL DEFAULT '' COMMENT '车牌号码',
            `status` tinyint(1) NOT NULL DEFAULT '0',
            `updatetime` int(10) NOT NULL DEFAULT '0' COMMENT '更新时间',
            `lasttime` int(10) NOT NULL DEFAULT '0' COMMENT '到期时间',
            `dateline` int(10) NOT NULL DEFAULT '0' COMMENT '领卡时间',
            PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `ims_weisrc_dish_school` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `weid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '所属帐号',
  `title` varchar(50) NOT NULL COMMENT '区域名称',
  `lat` decimal(18,10) NOT NULL DEFAULT '0.0000000000' COMMENT '经度',
  `lng` decimal(18,10) NOT NULL DEFAULT '0.0000000000' COMMENT '纬度',
  `displayorder` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '排序',
  `dateline` int(10) unsigned NOT NULL DEFAULT '0',
  `status` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '状态',
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `ims_weisrc_dish_checkuser` (
  `id` int(10) NOT NULL AUTO_INCREMENT,
  `weid` int(10) unsigned NOT NULL,
  `storeid` int(10) unsigned NOT NULL,
  `from_user` varchar(100) DEFAULT '' COMMENT '用户ID',
  `is_check` tinyint(1) DEFAULT '0',
  `dateline` int(10) DEFAULT '0' COMMENT '创建时间',
  PRIMARY KEY (`id`),
  KEY `idx_openid` (`from_user`)
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `ims_weisrc_dish_poster` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `weid` int(11) DEFAULT '0',
  `keywords` varchar(50) DEFAULT '',
  `title` varchar(50) DEFAULT '',
  `data` text,
  `bg` varchar(500) DEFAULT '',
  `miss_font` varchar(50) DEFAULT NULL,
  `first_info` varchar(200) DEFAULT NULL,
  `miss_wait` varchar(200) DEFAULT NULL,
  `starttime` int(10) DEFAULT '0',
  `endtime` int(10) DEFAULT '0',
  `miss_start` varchar(200) DEFAULT NULL,
  `miss_end` varchar(200) DEFAULT NULL,
  `miss_sub` varchar(200) DEFAULT NULL,
  `miss_resub` varchar(200) DEFAULT NULL,
  `miss_temp` varchar(200) DEFAULT NULL,
  `miss_back` varchar(200) DEFAULT NULL,
  `miss_finish` varchar(200) DEFAULT NULL,
  `miss_youzan` varchar(200) DEFAULT NULL,
  `miss_cj` varchar(200) DEFAULT NULL,
  `stitle` text,
  `sthumb` text,
  `sdesc` text,
  `surl` text,
  `miss_name` varchar(50) DEFAULT '',
  `xzlx` int(1) NOT NULL DEFAULT '0',
  `fans_limit` int(1) NOT NULL DEFAULT '0',
  `area` text NOT NULL,
  `sex` int(1) NOT NULL DEFAULT '0',
  `iptype` int(1) NOT NULL DEFAULT '0',
  `posttype` int(1) NOT NULL DEFAULT '0',
  `miss_num` int(10) DEFAULT '0',
  `dateline` int(10) DEFAULT '0',
  PRIMARY KEY (`id`),
  KEY `weid` (`weid`)
)ENGINE=MyISAM DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `ims_weisrc_dish_pic` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `styleid` int(10) unsigned NOT NULL,
  `weid` int(10) unsigned NOT NULL,
  `pictitle` varchar(100) NOT NULL DEFAULT '',
  `picurl` varchar(200) NOT NULL DEFAULT '',
  `picimage` varchar(500) NOT NULL DEFAULT '',
  `nowprice` varchar(50) NOT NULL DEFAULT '',
  `oldprice` varchar(50) NOT NULL DEFAULT '',
  `dateline` int(10) unsigned NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `ims_weisrc_dish_style` (
    `id` int(10) NOT NULL AUTO_INCREMENT,
    `weid` int(10) NOT NULL DEFAULT '0' COMMENT '公众号id',
    `title` varchar(100) NOT NULL,
    `type` varchar(100) NOT NULL,
    `slidetype` tinyint(1) NOT NULL DEFAULT '1' COMMENT '',
    `status` tinyint(1) NOT NULL DEFAULT '0' COMMENT '状态',
    `displayorder` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '排序',
    `dateline` int(10) NOT NULL DEFAULT '0',
    PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `ims_weisrc_dish_delivery_record` (
    `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
    `weid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '所属帐号',
    `storeid` int(10) NOT NULL DEFAULT '0' COMMENT '门店id',
    `orderid` int(10) NOT NULL DEFAULT '0' COMMENT '订单id',
    `delivery_id` int(10) NOT NULL DEFAULT '0' COMMENT '配送员id',
    `price` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '',
    `dateline` int(10) unsigned NOT NULL DEFAULT '0',
    `status` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '状态',
    PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `ims_weisrc_dish_recharge` (
    `id` int(10) NOT NULL AUTO_INCREMENT,
    `weid` int(10) NOT NULL DEFAULT '0' COMMENT '公众号id',
    `storeid` int(10) NOT NULL DEFAULT '0' COMMENT '门店id',
    `title` varchar(200) NOT NULL COMMENT '活动名称',
    `recharge_value` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '充值多少',
    `give_value` int(10) NOT NULL DEFAULT '0' COMMENT '赠送多少',
    `total` int(10) NOT NULL DEFAULT '0' COMMENT '几期',
    `starttime` int(10) NOT NULL DEFAULT '0' COMMENT '开始时间',
    `endtime` int(10) NOT NULL DEFAULT '0' COMMENT '结束时间',
    `content` text NOT NULL DEFAULT '' COMMENT '',
    `displayorder` tinyint(4) NOT NULL DEFAULT '0' COMMENT '排序',
    `status` tinyint(1) NOT NULL DEFAULT '0' COMMENT '状态',
    `dateline` int(10) NOT NULL DEFAULT '0',
    PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `ims_weisrc_dish_recharge_record` (
    `id` int(10) NOT NULL AUTO_INCREMENT,
    `rechargeid` int(10) NOT NULL DEFAULT '0' COMMENT '',
    `weid` int(10) NOT NULL DEFAULT '0' COMMENT '公众号id',
    `from_user` varchar(100) DEFAULT '',
    `storeid` int(10) NOT NULL DEFAULT '0' COMMENT '门店id',
    `orderid` int(10) NOT NULL DEFAULT '0' COMMENT '订单id',
    `price` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '',
    `displayorder` tinyint(4) NOT NULL DEFAULT '0' COMMENT '排序',
    `status` tinyint(1) NOT NULL DEFAULT '0' COMMENT '状态',
    `remark` text NOT NULL DEFAULT '' COMMENT '备注',
    `givetime` int(10) NOT NULL DEFAULT '0',
    `endtime` int(10) NOT NULL DEFAULT '0' COMMENT '结束时间',
    `dateline` int(10) NOT NULL DEFAULT '0',
    PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `ims_wechat_reply` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `title` varchar(50) NOT NULL COMMENT '',
  `url` varchar(500) NOT NULL DEFAULT '' COMMENT '',
  `displayorder` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '',
  `status` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '',
  `dateline` int(10) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `ims_modules_reply` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `title` varchar(50) NOT NULL COMMENT '',
  `url` varchar(500) NOT NULL DEFAULT '' COMMENT '',
  `displayorder` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '',
  `status` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '',
  `dateline` int(10) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `ims_weisrc_dish_print_label` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `storeid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '门店id',
  `weid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '所属帐号',
  `title` varchar(50) NOT NULL COMMENT '标签名称',
  `displayorder` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '排序',
  `status` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '是否开启',
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `ims_weisrc_dish_print_goods` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `weid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '所属帐号',
  `storeid` int(10) unsigned NOT NULL DEFAULT '0',
  `print_type` varchar(50) NOT NULL COMMENT '打印机类型',
  `print_usr` varchar(50) DEFAULT '',
  `orderid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '',
  `goodsid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '',
  `optionid` varchar(200) DEFAULT '',
  `optionname` varchar(200) DEFAULT '',
  `price` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '',
  `total` int(10) unsigned NOT NULL DEFAULT '0',
  `dateline` int(10) unsigned NOT NULL DEFAULT '0',
  `status` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '是否已打印',
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `ims_weisrc_dish_savewine_log` (
    `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
    `weid` int(10) unsigned NOT NULL,
    `tablesid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '',
    `storeid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '门店编号',
    `from_user` varchar(100) DEFAULT '',
    `savenumber` varchar(100) NOT NULL DEFAULT '' COMMENT '存酒卡号',
    `title` varchar(200) DEFAULT NULL COMMENT '物品名称',
    `username` varchar(100) DEFAULT NULL COMMENT '用户姓名',
    `tel` varchar(30) DEFAULT NULL COMMENT '联系电话',
    `remark` text NOT NULL DEFAULT '' COMMENT '备注',
    `displayorder` int(10) unsigned NOT NULL DEFAULT '0',
    `status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '状态',
    `takeouttime` int(10) unsigned NOT NULL DEFAULT '0',
    `savetime` int(10) unsigned NOT NULL DEFAULT '0',
    `dateline` int(10) unsigned NOT NULL DEFAULT '0',
    PRIMARY KEY (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `ims_weisrc_dish_savewine_record` (
    `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
    `weid` int(10) unsigned NOT NULL,
    `type` int(10) unsigned NOT NULL DEFAULT '1' COMMENT '',
    `storeid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '门店编号',
    `savewineid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '',
    `goodsid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '订单编号',
    `total` int(10) unsigned NOT NULL DEFAULT '0',
    `dateline` int(10) unsigned NOT NULL DEFAULT '0',
    PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `ims_weisrc_dish_savewine_goods` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `weid` int(10) unsigned NOT NULL,
  `storeid` int(10) unsigned NOT NULL,
  `savewineid` int(10) unsigned NOT NULL,
  `goodsid` int(10) unsigned NOT NULL,
  `total` int(10) unsigned NOT NULL DEFAULT '1',
  `remark` varchar(100) DEFAULT NULL COMMENT '',
  `status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '状态',
  `dateline` int(10) unsigned NOT NULL,
  `savetime` int(10) unsigned NOT NULL DEFAULT '0',
  `takeouttime` int(10) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `ims_weisrc_dish_service_log` (
    `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
    `weid` int(10) unsigned NOT NULL,
    `storeid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '门店编号',
    `orderid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '订单编号',
    `from_user` varchar(100) DEFAULT '',
    `type` tinyint(1) NOT NULL DEFAULT '4' COMMENT '订单:1,服务员:2,打包:3,消息:4',
    `content` varchar(1000) DEFAULT NULL COMMENT '内容',
    `status` tinyint(1) NOT NULL DEFAULT '0' COMMENT '状态',
    `dateline` int(10) unsigned NOT NULL DEFAULT '0',
    PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `ims_weisrc_dish_order_log` (
    `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
    `weid` int(10) unsigned NOT NULL,
    `storeid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '门店编号',
    `orderid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '订单编号',
    `content` varchar(1000) DEFAULT NULL COMMENT '内容',
    `fromtype` tinyint(1) NOT NULL DEFAULT '0' COMMENT '来源',
    `status` tinyint(1) NOT NULL DEFAULT '0' COMMENT '状态',
    `dateline` int(10) unsigned NOT NULL DEFAULT '0',
    PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `ims_weisrc_dish_credits_record` (
    `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
    `weid` int(10) unsigned NOT NULL,
    `from_user` varchar(100) DEFAULT '' COMMENT '',
    `credittype` varchar(100) DEFAULT '' COMMENT '积分类型',
    `num` decimal(10,2) default '0.00',
    `operator` varchar(100) DEFAULT '' COMMENT '',
    `remark` varchar(1000) DEFAULT NULL COMMENT '内容',
    `dateline` int(10) unsigned NOT NULL DEFAULT '0',
    PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `ims_weisrc_dish_commission` (
    `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
    `weid` int(10) unsigned default 0,
    `storeid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '门店编号',
    `orderid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '订单编号',
    `agentid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '上级编号',
    `ordersn` varchar(100) DEFAULT '' COMMENT '',
    `from_user` varchar(100) DEFAULT '' COMMENT '购买者openid',
    `price` decimal(10,2) default '0.00',
    `level` tinyint(1) NOT NULL DEFAULT '1' COMMENT '级别',
    `status` tinyint(1) NOT NULL DEFAULT '0' COMMENT '状态',
    `dateline` int(10) DEFAULT 0,
    PRIMARY KEY (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `ims_weisrc_dish_tpl_log` (
    `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
    `weid` int(10) unsigned default 0,
    `storeid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '门店编号',
    `orderid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '订单编号',
    `ordersn` varchar(100) DEFAULT '' COMMENT '',
    `from_user` varchar(100) DEFAULT '' COMMENT '接收者openid',
    `content` varchar(1000) DEFAULT '' COMMENT '内容',
    `result` varchar(200) DEFAULT '' COMMENT '内容结果',
    `dateline` int(10) DEFAULT 0,
    PRIMARY KEY (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `ims_weisrc_dish_feedback` (
    `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
    `weid` int(10) unsigned default 0,
    `storeid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '门店编号',
    `orderid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '订单编号',
    `from_user` varchar(100) DEFAULT '',
    `star` tinyint(1) NOT NULL DEFAULT '5' COMMENT '等级',
    `content` varchar(500) DEFAULT '' COMMENT '内容',
    `replycontent` varchar(500) DEFAULT '' COMMENT '回复内容',
    `displayorder` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '排序',
    `status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '状态',
    `dateline` int(10) DEFAULT 0,
    PRIMARY KEY (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `ims_weisrc_dish_coupon` (
    `id` int(10) NOT NULL AUTO_INCREMENT,
    `weid` int(10) NOT NULL DEFAULT '0' COMMENT '公众号id',
    `storeid` int(10) NOT NULL DEFAULT '0' COMMENT '门店id',
    `levelid` tinyint(1) NOT NULL DEFAULT '0' COMMENT '所属人群',
    `title` varchar(50) NOT NULL COMMENT '优惠券名称',
    `thumb` varchar(500) NOT NULL DEFAULT '' COMMENT '图片',
    `attr_type` tinyint(1) NOT NULL DEFAULT '1' COMMENT '属性 1=普通券 2=营销券',
    `ruletype` tinyint(1) NOT NULL DEFAULT '1' COMMENT '1=不限 2=首单',
    `type` tinyint(1) NOT NULL DEFAULT '1' COMMENT '优惠券类型 1=优惠券 2=代金券 3=礼品券 4=积分兑换',
    `gmoney` decimal(18,2) NOT NULL DEFAULT '0.00' COMMENT '支付金额',
    `dmoney` decimal(18,2) NOT NULL DEFAULT '0.00' COMMENT '抵用金额',
    `dcredit` int(10) NOT NULL DEFAULT '0' COMMENT '',
    `goodsids` varchar(1000) NOT NULL DEFAULT '0' COMMENT '商品',
    `content` text NOT NULL COMMENT '详细内容',
    `totalcount` int(10) NOT NULL DEFAULT '0' COMMENT '发放总数',
    `usercount` int(10) NOT NULL DEFAULT '0' COMMENT '每人领取张数',
    `ticket_ty` tinyint(1) NOT NULL DEFAULT '0' COMMENT '积分兑换优惠券类型 1=优惠券2=代金券3=礼品券',
    `ticket_id` int(10) NOT NULL DEFAULT '0' COMMENT '优惠券id',
    `needscore` int(10) NOT NULL DEFAULT '0' COMMENT '兑换需要积分',
    `starttime` int(10) NOT NULL DEFAULT '0' COMMENT '开始时间',
    `endtime` int(10) NOT NULL DEFAULT '0' COMMENT '结束时间',
    `is_meal` tinyint(1) NOT NULL DEFAULT '1' COMMENT '是否店内点餐',
    `is_delivery` tinyint(1) NOT NULL DEFAULT '1' COMMENT '是否外卖订餐',
    `is_snack` tinyint(1) NOT NULL DEFAULT '1' COMMENT '是否支持快餐',
    `is_reservation` tinyint(1) NOT NULL DEFAULT '1' COMMENT '是否支持预定',
    `is_shouyin` tinyint(1) NOT NULL DEFAULT '1' COMMENT '是否支持收银',
    `displayorder` tinyint(4) NOT NULL DEFAULT '0',
    `dateline` int(10) NOT NULL DEFAULT '0',
    PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `ims_weisrc_dish_sncode` (
    `id` int(10) NOT NULL AUTO_INCREMENT,
    `couponid` int(10) NOT NULL DEFAULT '0' COMMENT '优惠券id',
    `storeid` int(10) NOT NULL DEFAULT '0' COMMENT '门店id',
    `weid` int(10) NOT NULL DEFAULT '0' COMMENT '公众号id',
    `from_user` varchar(100) NOT NULL COMMENT 'openid',
    `title` varchar(40) NOT NULL,
    `sncode` varchar(100) NOT NULL COMMENT 'sn码',
    `type` tinyint(1) NOT NULL DEFAULT '0' COMMENT '1优惠券2代金券3礼品券',
    `money` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '消费金额',
    `status` tinyint(1) NOT NULL DEFAULT '0' COMMENT '状态',
    `isshow` tinyint(1) NOT NULL DEFAULT '1' COMMENT '是否显示 用户删除时更新',
    `winningtime` int(10) NOT NULL DEFAULT '0' COMMENT '生成时间',
    `usetime` int(10) NOT NULL DEFAULT '0' COMMENT '使用时间',
    `dateline` int(10) NOT NULL DEFAULT '0',
    PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `ims_weisrc_dish_fans` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `uid` int(11) DEFAULT '0',
  `weid` int(11) DEFAULT '0',
  `sceneid` int(11) DEFAULT NULL,
  `ticketid` varchar(200) DEFAULT NULL,
  `url` varchar(500) DEFAULT NULL,
  `storeid` int(11) DEFAULT '0',
  `agentid` int(11) DEFAULT '0',
  `agentid2` int(11) DEFAULT '0',
  `agentid3` int(11) DEFAULT '0',
  `is_commission` tinyint(1) DEFAULT '1',
  `commission_price` decimal(18,2) NOT NULL DEFAULT '0.00' COMMENT '',
  `delivery_price` decimal(18,2) NOT NULL DEFAULT '0.00' COMMENT '',
  `from_user` varchar(50) DEFAULT '' COMMENT '用户ID',
  `nickname` varchar(50) DEFAULT '',
  `scene_str` varchar(500) DEFAULT '',
  `headimgurl` varchar(500) DEFAULT '',
  `username` varchar(50) DEFAULT '',
  `mobile` varchar(50) DEFAULT '',
  `address` varchar(200) DEFAULT '',
  `storeids` text COMMENT '门店',
  `sex` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '性别',
  `country` varchar(50) DEFAULT '',
  `province` varchar(50) DEFAULT '',
  `city` varchar(50) DEFAULT '',
  `lat` decimal(18,10) NOT NULL DEFAULT '0.0000000000' COMMENT '经度',
  `lng` decimal(18,10) NOT NULL DEFAULT '0.0000000000' COMMENT '纬度',
  `totalprice` decimal(18,2) NOT NULL DEFAULT '0.00' COMMENT '交易总金额',
  `avgprice` decimal(18,2) NOT NULL DEFAULT '0.00' COMMENT '平均金额',
  `totalcount` int(10) DEFAULT '0' COMMENT '交易次数',
  `paytime` int(10) DEFAULT '0' COMMENT '上次交易时间',
  `status` tinyint(1) DEFAULT '1',
  `is_check` tinyint(1) DEFAULT '0',
  `noticetime` int(10) DEFAULT '0',
  `lastsendtime` int(10) DEFAULT '0',
  `lasttime` int(10) DEFAULT '0',
  `dateline` int(10) DEFAULT '0',
  PRIMARY KEY (`id`),
  KEY `indx_rid` (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `ims_weisrc_dish_sms_checkcode` (
  `id` int(10) NOT NULL AUTO_INCREMENT,
  `weid` int(10) unsigned NOT NULL,
  `from_user` varchar(100) DEFAULT '' COMMENT '用户ID',
  `mobile` varchar(30) DEFAULT '' COMMENT '手机',
  `checkcode` varchar(100) DEFAULT '' COMMENT '验证码',
  `status` tinyint(1) unsigned DEFAULT '0' COMMENT '状态 0未使用1已使用',
  `dateline` int(10) DEFAULT '0' COMMENT '创建时间',
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `ims_weisrc_dish_reservation` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `weid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '所属帐号',
  `storeid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '门店',
  `tablezonesid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '餐桌类型id',
  `time` varchar(200) NOT NULL DEFAULT '' COMMENT '预定时间',
  `label` varchar(50) NOT NULL DEFAULT '' COMMENT '标签',
  `displayorder` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '排序',
  `dateline` int(10) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `ims_weisrc_dish_tables_order` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `weid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '所属帐号',
  `tablesid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '',
  `storeid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '',
  `from_user` varchar(200) NOT NULL DEFAULT '' COMMENT '',
  `dateline` int(10) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `ims_weisrc_dish_tables` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `weid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '所属帐号',
  `storeid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '',
  `print_label` int(4) NOT NULL DEFAULT 0 COMMENT '',
  `tablezonesid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '',
  `scene_str` varchar(500) DEFAULT '',
  `thumb` varchar(500) NOT NULL DEFAULT '' COMMENT '图片',
  `title` varchar(200) NOT NULL DEFAULT '' COMMENT '名字(桌台号)',
  `url` varchar(500) NOT NULL DEFAULT '' COMMENT '',
  `user_count` int(10) NOT NULL DEFAULT '0' COMMENT '可供就餐人数',
  `displayorder` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '排序',
  `dateline` int(10) unsigned NOT NULL DEFAULT '0',
  `is_seat` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '',
  `status` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '状态',
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `ims_weisrc_dish_tablezones` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `weid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '所属帐号',
  `storeid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '',
  `title` varchar(200) NOT NULL DEFAULT '' COMMENT '',
  `limit_price` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '',
  `reservation_price` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '',
  `table_count` int(10) NOT NULL DEFAULT '0' COMMENT '餐桌数量',
  `service_rate` decimal(10,2) DEFAULT '0.00',
  `displayorder` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '排序',
  `dateline` int(10) unsigned NOT NULL DEFAULT '0',
  `status` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '状态',
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `ims_weisrc_dish_queue_setting` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `weid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '所属帐号',
  `storeid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '',
  `title` varchar(200) NOT NULL DEFAULT '' COMMENT '',
  `limit_num` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '',
  `prefix` varchar(50) NOT NULL COMMENT '',
  `starttime` varchar(50) NOT NULL DEFAULT '00:00' COMMENT '开始时间',
  `endtime` varchar(50) NOT NULL DEFAULT '23:59' COMMENT '结束时间',
  `notify_number` int(10) NOT NULL DEFAULT '0' COMMENT '通知人数',
  `displayorder` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '排序',
  `dateline` int(10) unsigned NOT NULL DEFAULT '0',
  `status` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '状态',
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `ims_weisrc_dish_queue_order` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `weid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '所属帐号',
  `queueid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '',
  `storeid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '',
  `from_user` varchar(200) NOT NULL DEFAULT '' COMMENT '',
  `num` varchar(100) NOT NULL DEFAULT '' COMMENT '',
  `mobile` varchar(30) NOT NULL DEFAULT '' COMMENT '',
  `usercount` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '',
  `isnotify` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '状态',
  `status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '状态',
  `dateline` int(10) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `ims_weisrc_dish_account` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `weid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '所属帐号',
  `storeid` varchar(1000) NOT NULL COMMENT '',
  `uid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '',
  `schoolid` int(10) NOT NULL DEFAULT '0' COMMENT '学校id',
  `from_user` varchar(100) NOT NULL DEFAULT '' COMMENT '',
  `accountname` varchar(50) NOT NULL DEFAULT '',
  `password` varchar(200) NOT NULL DEFAULT '',
  `salt` varchar(10) NOT NULL DEFAULT '',
  `pwd` varchar(50) NOT NULL COMMENT '',
  `mobile` varchar(20) NOT NULL COMMENT '',
  `email` varchar(20) NOT NULL COMMENT '',
  `username` varchar(50) NOT NULL COMMENT '',
  `pay_account` varchar(200) NOT NULL COMMENT '',
  `displayorder` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '排序',
  `dateline` int(10) unsigned NOT NULL DEFAULT '0',
  `status` tinyint(1) unsigned NOT NULL DEFAULT '2' COMMENT '状态',
  `role` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '1:店长,2:店员,3:区管理员',
  `lastvisit` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '',
  `lastip` varchar(15) NOT NULL COMMENT '',
  `areaid` int(10) NOT NULL DEFAULT '0' COMMENT '区域id',
  `is_admin_order` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '',
  `is_admin_goods` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '',
  `is_admin_money` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '',
  `is_admin_goodscate` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '',
  `is_admin_storeopen` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '',
  `is_notice_order` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '',
  `is_notice_queue` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '',
  `is_notice_service` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '',
  `is_notice_boss` tinyint(1) NOT NULL DEFAULT 0 COMMENT '',
  `lat` decimal(18,10) NOT NULL DEFAULT '0.0000000000' COMMENT '经度',
  `lng` decimal(18,10) NOT NULL DEFAULT '0.0000000000' COMMENT '纬度',
  `remark` varchar(1000) NOT NULL DEFAULT '' COMMENT '备注',
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `ims_weisrc_dish_area` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `weid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '所属帐号',
  `schoolid` int(10) NOT NULL DEFAULT '0' COMMENT '学校id',
  `name` varchar(50) NOT NULL COMMENT '区域名称',
  `parentid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '上级分类ID,0为第一级',
  `displayorder` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '排序',
  `dateline` int(10) unsigned NOT NULL DEFAULT '0',
  `status` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '状态',
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `ims_weisrc_dish_deliveryarea` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `weid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '所属帐号',
  `storeid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '所属门店',
  `title` varchar(50) NOT NULL COMMENT '区域名称',
  `displayorder` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '排序',
  `lat` decimal(18,10) NOT NULL DEFAULT '0.0000000000' COMMENT '经度',
  `lng` decimal(18,10) NOT NULL DEFAULT '0.0000000000' COMMENT '纬度',
  `dateline` int(10) unsigned NOT NULL DEFAULT '0',
  `status` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '状态',
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `ims_weisrc_dish_dispatcharea` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `weid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '所属帐号',
  `storeid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '所属门店',
  `title` varchar(50) NOT NULL COMMENT '区域名称',
  `displayorder` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '排序',
  `dateline` int(10) unsigned NOT NULL DEFAULT '0',
  `status` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '状态',
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `ims_weisrc_dish_blacklist` (
  `id` int(10) NOT NULL AUTO_INCREMENT,
  `weid` int(10) unsigned NOT NULL,
  `from_user` varchar(100) DEFAULT '' COMMENT '用户ID',
  `status` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `dateline` int(10) DEFAULT '0' COMMENT '创建时间',
  PRIMARY KEY (`id`),
  KEY `idx_openid` (`from_user`)
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `ims_weisrc_dish_cart` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `weid` int(10) unsigned NOT NULL,
  `from_user` varchar(50) NOT NULL,
  `storeid` int(10) unsigned NOT NULL,
  `goodsid` int(11) NOT NULL,
  `tableid` int(11) NOT NULL DEFAULT '0' COMMENT '',
  `optionid` varchar(200) DEFAULT '',
  `optionname` varchar(200) DEFAULT '',
  `goodstype` tinyint(1) NOT NULL DEFAULT '1',
  `price` varchar(10) NOT NULL,
  `packvalue` varchar(10) NOT NULL DEFAULT '0' COMMENT '打包费',
  `dateline` int(10) DEFAULT '0' COMMENT '创建时间',
  `total` int(10) unsigned NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `ims_weisrc_dish_category` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `storeid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '门店id',
  `weid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '所属帐号',
  `name` varchar(50) NOT NULL COMMENT '分类名称',
  `parentid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '上级分类ID,0为第一级',
  `savewinetime` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '',
  `rebate` decimal(5,2) NOT NULL default 10.00 COMMENT '打折费率',
  `is_discount` int(2) NOT NULL default 0 COMMENT '是否开启打折',
  `is_meal` tinyint(1) NOT NULL DEFAULT '1' COMMENT '是否店内点餐',
  `is_delivery` tinyint(1) NOT NULL DEFAULT '1' COMMENT '是否外卖订餐',
  `is_snack` tinyint(1) NOT NULL DEFAULT '1' COMMENT '是否支持快餐',
  `is_reservation` tinyint(1) NOT NULL DEFAULT '1' COMMENT '是否支持预定',
  `displayorder` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '排序',
  `enabled` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '是否开启',
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `ims_weisrc_dish_email_setting` (
  `id` int(10) NOT NULL AUTO_INCREMENT,
  `weid` int(10) unsigned NOT NULL,
  `storeid` int(10) unsigned NOT NULL,
  `email_enable` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '开启邮箱提醒',
  `email_host` varchar(50) DEFAULT '' COMMENT '邮箱服务器',
  `email_send` varchar(100) DEFAULT '' COMMENT '商户发送邮件邮箱',
  `email_pwd` varchar(20) DEFAULT '' COMMENT '邮箱密码',
  `email_user` varchar(100) DEFAULT '' COMMENT '发信人名称',
  `email` varchar(100) DEFAULT '' COMMENT '商户接收邮件邮箱',
  `email_business_tpl` varchar(200) DEFAULT '' COMMENT '商户接收内容模板',
  `dateline` int(10) DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `ims_weisrc_dish_goods` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `storeid` int(10) unsigned NOT NULL,
  `weid` int(10) unsigned NOT NULL COMMENT '公众号id',
  `labelid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '打印标签',
  `pcate` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '分类',
  `ccate` int(10) unsigned NOT NULL DEFAULT '0',
  `startcount` int(10) unsigned NOT NULL DEFAULT '1',
  `endcount` int(10) unsigned NOT NULL DEFAULT '0',
  `freecount` int(10) unsigned NOT NULL DEFAULT '0',
  `title` varchar(100) NOT NULL DEFAULT '' COMMENT '名称',
  `thumb` varchar(500) NOT NULL DEFAULT '' COMMENT '图片',
  `unitname` varchar(20) NOT NULL DEFAULT '份' COMMENT '单位',
  `description` varchar(1000) NOT NULL DEFAULT '' COMMENT '描述',
  `content` text COMMENT '',
  `week` varchar(100) NOT NULL DEFAULT '1,2,3,4,5,6,0' COMMENT '星期',
  `taste` varchar(1000) NOT NULL DEFAULT '' COMMENT '口味',
  `isspecial` tinyint(1) unsigned NOT NULL DEFAULT '1',
  `isoptions` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `marketprice` varchar(10) NOT NULL DEFAULT '' COMMENT '现价',
  `memberprice` varchar(10) NOT NULL DEFAULT '' COMMENT '会员价',
  `productprice` varchar(10) NOT NULL DEFAULT '' COMMENT '原价',
  `packvalue` varchar(10) NOT NULL DEFAULT '0' COMMENT '打包费',
  `delivery_commission_money` decimal(10,2) DEFAULT '0.00',
  `commission_money1` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '一级佣金',
  `commission_money2` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '二级佣金',
  `counts` int(10) NOT NULL DEFAULT '-1' COMMENT '今日库存',
  `today_counts` int(10) NOT NULL DEFAULT '0' COMMENT '今日销售量',
  `lasttime` int(10) NOT NULL DEFAULT '0' COMMENT '更新时间',
  `sales` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '总销量',
  `isshow_sales` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '',
  `credit` int(10) NOT NULL DEFAULT '0' COMMENT '奖励积分',
  `subcount` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '被点次数',
  `status` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '状态',
  `recommend` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '是否推荐',
  `deleted` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `displayorder` int(10) unsigned NOT NULL DEFAULT '0',
  `istime` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `begintime` varchar(20) DEFAULT '00:00' COMMENT '开始时间',
  `endtime` varchar(20) DEFAULT '23:59' COMMENT '结束时间',
  `startdate` int(10) NOT NULL DEFAULT '0' COMMENT '开始时间',
  `enddate` int(10) NOT NULL DEFAULT '0' COMMENT '结束时间',
  `dateline` int(10) unsigned NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `ims_weisrc_dish_intelligent` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `storeid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '门店id',
  `weid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '所属帐号',
  `title` varchar(200) NOT NULL DEFAULT '' COMMENT '商品',
  `thumb` varchar(500) NOT NULL DEFAULT '' COMMENT '',
  `name` int(10) NOT NULL DEFAULT '0' COMMENT '适用人数',
  `content` varchar(1000) NOT NULL DEFAULT '' COMMENT '商品',
  `displayorder` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '排序',
  `enabled` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '是否开启',
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `ims_weisrc_dish_notice` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `weid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '所属帐号',
  `schoolid` int(10) NOT NULL DEFAULT '0' COMMENT '学校id',
  `title` varchar(200) NOT NULL DEFAULT '' COMMENT '名称',
  `content` text COMMENT '',
  `url` varchar(1000) DEFAULT NULL,
  `displayorder` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '排序',
  `status` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '是否开启',
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `ims_weisrc_dish_notice_log` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `noticeid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '所属帐号',
  `from_user` varchar(50) NOT NULL,
  `dateline` int(10) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `ims_weisrc_dish_refund_log` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `from_user` varchar(50) NOT NULL,
  `remark` varchar(1000) NOT NULL DEFAULT '0' COMMENT '退款备注',
  `orderid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '商户订单号',
  `transaction_id` varchar(50) NOT NULL DEFAULT '0' COMMENT '微信订单号',
  `out_refund_no` varchar(50) NOT NULL DEFAULT '0' COMMENT '微信订单号',
  `refund_id` varchar(50) NOT NULL DEFAULT '0' COMMENT '微信退款单号',
  `total_fee` varchar(50) NOT NULL DEFAULT '0' COMMENT '订单总金额',
  `refund_fee` varchar(50) NOT NULL DEFAULT '0' COMMENT '微信退款单号',
  `status` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '状态',
  `err_code_des` varchar(200) NOT NULL DEFAULT '0' COMMENT '错误代码描述',
  `dateline` int(10) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `ims_weisrc_dish_nave` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `weid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '所属帐号',
  `type` int(10) NOT NULL DEFAULT '-1' COMMENT '链接类型 -1:自定义 1:首页2:门店3:菜单列表4:我的菜单',
  `name` varchar(50) NOT NULL DEFAULT '' COMMENT '导航名称',
  `link` varchar(200) NOT NULL DEFAULT '' COMMENT '导航链接',
  `displayorder` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '排序',
  `status` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '是否开启',
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `ims_weisrc_dish_order` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `weid` int(10) unsigned NOT NULL COMMENT '公众号id',
  `storeid` int(10) unsigned NOT NULL COMMENT '门店id',
  `is_hasten` tinyint(1) NOT NULL DEFAULT '0',
  `hastentime` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '',
  `couponid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '',
  `daycount` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '',
  `rechargeid` int(10) NOT NULL DEFAULT '0' COMMENT '',
  `delivery_mode` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '配送模式',
  `quicknum` varchar(30) NOT NULL DEFAULT '0001' COMMENT '',
  `from_user` varchar(50) NOT NULL,
  `ordersn` varchar(30) NOT NULL COMMENT '订单号',
  `totalnum` tinyint(4) DEFAULT NULL COMMENT '总数量',
  `totalprice` varchar(10) NOT NULL COMMENT '订单总金额',
  `oldtotalprice` varchar(10) NOT NULL COMMENT '原总金额',
  `tea_money` decimal(10,2) DEFAULT '0.00',
  `floor_money` decimal(10,2) DEFAULT '0.00',
  `refund_price` decimal(10,2) DEFAULT '0.00',
  `service_money` decimal(10,2) DEFAULT '0.00',
  `discount_money` decimal(10,2) DEFAULT '0.00',
  `one_order_getprice` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '每单提现手续费',
  `status` tinyint(4) NOT NULL DEFAULT '0' COMMENT '-1取消状态，0普通状态，1为确认付款方式，2为成功',
  `ispay` tinyint(1) NOT NULL DEFAULT '0' COMMENT '0,1,2',
  `is_sys_delivery` tinyint(1) NOT NULL DEFAULT '1' COMMENT '平台配送',
  `ismerge` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否合并的单子',
  `paytype` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '1余额，2微信支付，3到付',
  `transid` varchar(30) NOT NULL DEFAULT '0' COMMENT '微信支付单号',
  `username` varchar(50) NOT NULL DEFAULT '' COMMENT '用户名',
  `address` varchar(250) NOT NULL DEFAULT '' COMMENT '地址',
  `tel` varchar(50) NOT NULL DEFAULT '' COMMENT '联系电话',
  `meal_time` varchar(50) NOT NULL DEFAULT '' COMMENT '就餐时间',
  `dinner_time` varchar(50) NOT NULL DEFAULT '' COMMENT '用餐时间',
  `counts` tinyint(4) DEFAULT '0' COMMENT '预订人数',
  `seat_type` tinyint(1) DEFAULT '0' COMMENT '位置类型1大厅2包间',
  `seat` int(10) NOT NULL DEFAULT '0' COMMENT '',
  `carports` tinyint(3) DEFAULT '0' COMMENT '车位',
  `delivery_id` int(10) NOT NULL DEFAULT '0' COMMENT '配送员id',
  `delivery_status` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '',
  `deliveryareaid` int(10) NOT NULL DEFAULT '0' COMMENT '配送点id',
  `delivery_money` decimal(11,2) NOT NULL default '0' COMMENT '佣金',
  `goodsprice` decimal(10,2) default 0,
  `dispatchprice` decimal(10,2) default 0,
  `packvalue` varchar(10) NOT NULL DEFAULT '0' COMMENT '打包费',
  `dining_mode` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '用餐类型 1:到店 2:外卖',
  `is_append` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '是否加单',
  `remark` varchar(1000) NOT NULL DEFAULT '' COMMENT '备注',
  `reply` varchar(1000) NOT NULL DEFAULT '' COMMENT '回复',
  `paydetail` varchar(1000) NOT NULL DEFAULT '' COMMENT '消费详细信息',
  `credit` varchar(10) NOT NULL DEFAULT '0' COMMENT '赠送积分',
  `tables` varchar(10) NOT NULL DEFAULT '' COMMENT '桌号',
  `tablezonesid` varchar(10) NOT NULL DEFAULT '' COMMENT '桌台类别',
  `print_sta` tinyint(1) DEFAULT '-1' COMMENT '打印状态',
  `sign` tinyint(1) NOT NULL DEFAULT '0' COMMENT '-1拒绝，0未处理，1已处理',
  `lat` decimal(18,10) NOT NULL DEFAULT '0.0000000000' COMMENT '经度',
  `lng` decimal(18,10) NOT NULL DEFAULT '0.0000000000' COMMENT '纬度',
  `isfinish` tinyint(1) NOT NULL DEFAULT '0',
  `isemail` tinyint(1) NOT NULL DEFAULT '0',
  `ischeckfans` tinyint(1) NOT NULL DEFAULT '0',
  `issms` tinyint(1) NOT NULL DEFAULT '0',
  `istpl` tinyint(1) NOT NULL DEFAULT '0',
  `delivery_notice` tinyint(1) NOT NULL DEFAULT '0',
  `isfeedback` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否留言',
  `isfengniao` tinyint(1) NOT NULL DEFAULT '0' COMMENT '',
  `isvip` tinyint(1) NOT NULL DEFAULT '0' COMMENT '会员',
  `finishtime` int(10) DEFAULT '0' COMMENT '完成时间',
  `confirmtime` int(10) DEFAULT '0' COMMENT '确认时间',
  `paytime` int(10) DEFAULT '0' COMMENT '付款时间',
  `isprint` tinyint(1) NOT NULL DEFAULT '0' COMMENT '',
  `delivery_finish_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '已配送时间',
  `newlimitprice` varchar(500) NOT NULL DEFAULT '' COMMENT '',
  `oldlimitprice` varchar(500) NOT NULL DEFAULT '' COMMENT '',
  `newlimitpricevalue` varchar(10) NOT NULL DEFAULT '' COMMENT '',
  `oldlimitpricevalue` varchar(10) NOT NULL DEFAULT '' COMMENT '',
  `dateline` int(10) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `ims_weisrc_dish_order_goods` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `weid` int(10) unsigned NOT NULL,
  `storeid` int(10) unsigned NOT NULL,
  `orderid` int(10) unsigned NOT NULL,
  `goodsid` int(10) unsigned NOT NULL,
  `optionid` int(10) DEFAULT '0',
  `optionname` varchar(200) DEFAULT '',
  `price` varchar(10) NOT NULL,
  `total` int(10) unsigned NOT NULL DEFAULT '1',
  `dateline` int(10) unsigned NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `ims_weisrc_dish_print_order` (
  `id` int(10) NOT NULL AUTO_INCREMENT,
  `weid` int(10) unsigned NOT NULL,
  `orderid` int(10) unsigned NOT NULL,
  `print_usr` varchar(50) DEFAULT '',
  `print_status` tinyint(1) DEFAULT '-1',
  `dateline` int(10) DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `ims_weisrc_dish_print_setting` (
  `id` int(10) NOT NULL AUTO_INCREMENT,
  `weid` int(10) unsigned NOT NULL,
  `storeid` int(10) unsigned NOT NULL,
  `title` varchar(200) DEFAULT '',
  `print_status` tinyint(1) NOT NULL,
  `type` varchar(50) DEFAULT 'hongxin',
  `position_type` tinyint(1) DEFAULT '1',
  `yilian_type` tinyint(1) DEFAULT '1',
  `api_key` varchar(100) DEFAULT '' COMMENT 'api密钥',
  `member_code` varchar(100) DEFAULT '' COMMENT '商户代码',
  `feyin_key` varchar(100) DEFAULT '' COMMENT 'api密钥',
  `print_type` tinyint(1) NOT NULL,
  `print_usr` varchar(50) DEFAULT '',
  `print_nums` tinyint(3) DEFAULT '1',
  `print_top` varchar(40) DEFAULT '',
  `print_bottom` varchar(40) DEFAULT '',
  `is_print_all` tinyint(1) NOT NULL DEFAULT '1',
  `is_meal` tinyint(1) NOT NULL DEFAULT '1' COMMENT '是否店内点餐',
  `is_delivery` tinyint(1) NOT NULL DEFAULT '1' COMMENT '是否外卖订餐',
  `is_snack` tinyint(1) NOT NULL DEFAULT '1' COMMENT '是否支持快餐',
  `is_reservation` tinyint(1) NOT NULL DEFAULT '1' COMMENT '是否支持预定',
  `is_shouyin` tinyint(1) NOT NULL DEFAULT '1' COMMENT '是否支持收银',
  `is_nums` tinyint(1) NOT NULL DEFAULT '0' COMMENT '每个商品打印一次',
  `api_type` tinyint(1) NOT NULL DEFAULT '0' COMMENT '打印机api类型',
  `print_label` varchar(500) DEFAULT '0',
  `print_goodstype` varchar(500) DEFAULT '0',
  `qrcode_status` tinyint(1) NOT NULL DEFAULT '0',
  `qrcode_url` varchar(200) DEFAULT '',
  `dateline` int(10) DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `ims_weisrc_dish_reply` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `rid` int(10) unsigned NOT NULL,
  `weid` int(10) unsigned NOT NULL,
  `title` varchar(255) NOT NULL DEFAULT '',
  `type` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '入口类型',
  `storeid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '入口门店',
  `description` varchar(1000) NOT NULL DEFAULT '',
  `picture` varchar(255) NOT NULL DEFAULT '',
  `dateline` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '添加日期',
  PRIMARY KEY (`id`),
  KEY `idx_rid` (`rid`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `ims_weisrc_dish_wxappsetting` (
  `id` int(10) NOT NULL AUTO_INCREMENT,
  `weid` int(10) unsigned NOT NULL DEFAULT '0',
  `wxappid` varchar(200) DEFAULT '' COMMENT '',
  `wxappweid` int(10) unsigned NOT NULL DEFAULT '0',
  `storeid` int(10) unsigned NOT NULL DEFAULT '0',
  `bartitle` varchar(200) DEFAULT '' COMMENT '',
  `dateline` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '添加日期',
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `ims_weisrc_dish_setting` (
  `id` int(10) NOT NULL AUTO_INCREMENT,
  `weid` int(10) unsigned NOT NULL,
  `title` varchar(50) DEFAULT '' COMMENT '网站名称',
  `thumb` varchar(200) DEFAULT '' COMMENT '背景图',
  `qqmapapi` varchar(200) DEFAULT '' COMMENT '',
  `storeid` int(10) unsigned NOT NULL DEFAULT '0',
  `mode` tinyint(1) NOT NULL DEFAULT '0' COMMENT '模式',
  `is_check_user` tinyint(1) NOT NULL DEFAULT '0' COMMENT '用户是否需要审核',
  `is_notice` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '开启提醒',
  `is_school` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '',
  `is_show_storeinfo` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '',
  `is_yunzhong` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '',
  `entrance_type` tinyint(1) unsigned NOT NULL COMMENT '入口类型1:首页2门店列表3商品列表4我的菜单',
  `entrance_storeid` tinyint(1) unsigned NOT NULL COMMENT '入口门店id',
  `order_enable` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '订餐开启',
  `dining_mode` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '用餐类型 1:到店 2:外卖',
  `istplnotice` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否模版通知',
  `auth_mode` tinyint(1) NOT NULL DEFAULT '1' COMMENT '',
  `tpltype` tinyint(1) NOT NULL DEFAULT '1' COMMENT '模版行业类型',
  `tplneworder` varchar(200) DEFAULT '' COMMENT '模板id',
  `tplnewqueue` varchar(200) DEFAULT '' COMMENT '模板id',
  `tploperator` varchar(200) DEFAULT '' COMMENT '模板id',
  `tplmission` varchar(200) DEFAULT '' COMMENT '模板id',
  `tplcoupon` varchar(200) DEFAULT '' COMMENT '模板id',
  `fengniao_appid` varchar(200) DEFAULT '' COMMENT '',
  `fengniao_key` varchar(200) DEFAULT '' COMMENT '',
  `tplboss` varchar(200) NOT NULL DEFAULT '' COMMENT '',
  `tplapplynotice` varchar(200) NOT NULL DEFAULT '' COMMENT '',
  `link_card_name` varchar(100) DEFAULT '' COMMENT '',
  `link_card` varchar(500) DEFAULT '' COMMENT '',
  `link_sign_name` varchar(100) DEFAULT '' COMMENT '',
  `link_sign` varchar(500) DEFAULT '' COMMENT '',
  `searchword` varchar(1000) DEFAULT '' COMMENT '搜索关键字',
  `tpluser` text COMMENT '通知用户',
  `sms_enable` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '开启短信提醒',
  `sms_username` varchar(20) DEFAULT '' COMMENT '平台帐号',
  `sms_pwd` varchar(20) DEFAULT '' COMMENT '平台密码',
  `sms_mobile` varchar(20) DEFAULT '' COMMENT '商户接收短信手机',
  `email_enable` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '开启邮箱提醒',
  `email_host` varchar(50) DEFAULT '' COMMENT '邮箱服务器',
  `email_send` varchar(100) DEFAULT '' COMMENT '商户发送邮件邮箱',
  `email_pwd` varchar(20) DEFAULT '' COMMENT '邮箱密码',
  `email_user` varchar(100) DEFAULT '' COMMENT '发信人名称',
  `email` varchar(100) DEFAULT '' COMMENT '平台接收邮件邮箱',
  `auto_finish_time` int(10) unsigned NOT NULL DEFAULT '24' COMMENT '自动时间',
  `isshow_table_store` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '',
  `isshow_table_order` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '',
  `getcash_price` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '最低提现金额',
  `service_range` int(10) unsigned NOT NULL DEFAULT '20000' COMMENT '服务范围',
  `fee_rate` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '提现费率',
  `one_order_getprice` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '每单提现手续费',
  `fee_min` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '提现手续费最低金额',
  `fee_max` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '提现手续费最高金额',
  `is_open_price` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '开启提现',
  `is_commission` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '开启分销',
  `is_show_toutiao` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '',
  `is_show_visit` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '',
  `commission_keywords` varchar(200) DEFAULT '' COMMENT '',
  `table_cover` varchar(500) DEFAULT '' COMMENT '',
  `table_desc` varchar(200) DEFAULT '' COMMENT '',
  `commission_level` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '分销级别',
  `commission_mode` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '分销模式',
  `commission_money_mode` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '佣金模式',
  `commission1_rate_max` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '佣金费率',
  `commission1_value_max` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '提现手续费最低金额',
  `commission2_rate_max` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '佣金费率',
  `commission2_value_max` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '提现手续费最低金额',
  `commission3_rate_max` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '佣金费率',
  `commission3_value_max` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '提现手续费最低金额',
  `commission_settlement` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '佣金结算方式',
  `is_verify_mobile` tinyint(1) NOT NULL DEFAULT '0' COMMENT '',
  `credit_mode` tinyint(1) NOT NULL DEFAULT '1' COMMENT '1:商品积分;2订单金额计算',
  `fengniao_mode` tinyint(1) NOT NULL DEFAULT '1' COMMENT '1:正式启用;2:调试阶段',
  `payx_credit` int(10) NOT NULL DEFAULT '0' COMMENT '消费一元积分',
  `dayu_appkey` varchar(200) DEFAULT '' COMMENT '',
  `dayu_secretkey` varchar(200) DEFAULT '' COMMENT '',
  `dayu_verify_code` varchar(200) DEFAULT '' COMMENT '',
  `dayu_sign` varchar(200) DEFAULT '' COMMENT '',
  `delivery_mode` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '配送通知模式',
  `delivery_commission_mode` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '配送佣金模式',
  `delivery_money` decimal(11,2) NOT NULL default '0' COMMENT '佣金',
  `delivery_cash_price` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '提现最低金额',
  `delivery_rate` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '佣金费率',
  `delivery_order_max` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '配送订单数量限制',
  `delivery_auto_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '自动推送配送员时间设置',
  `delivery_finish_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '自动完成已配送订单',
  `link_recharge` varchar(500) DEFAULT '' COMMENT '',
  `link_recharge_name` varchar(100) DEFAULT '' COMMENT '',
  `wechat` tinyint(1) NOT NULL DEFAULT '1' COMMENT '',
  `alipay` tinyint(1) NOT NULL DEFAULT '1' COMMENT '',
  `credit` tinyint(1) NOT NULL DEFAULT '1' COMMENT '',
  `delivery` tinyint(1) NOT NULL DEFAULT '1' COMMENT '',
  `is_speaker` tinyint(1) NOT NULL DEFAULT '1' COMMENT '',
  `is_show_virtual` tinyint(1) NOT NULL DEFAULT '0' COMMENT '',
  `is_auto_address` tinyint(1) NOT NULL DEFAULT '0' COMMENT '',
  `is_show_home` tinyint(1) NOT NULL DEFAULT '1' COMMENT '',
  `is_operator_pwd` tinyint(1) NOT NULL DEFAULT '0' COMMENT '',
  `is_contain_delivery` tinyint(1) NOT NULL DEFAULT '1' COMMENT '',
  `is_auto_commission` tinyint(1) NOT NULL DEFAULT '0' COMMENT '',
  `is_quick_money` tinyint(1) NOT NULL DEFAULT '0' COMMENT '提现周期',
  `is_show_search` tinyint(1) NOT NULL DEFAULT '0' COMMENT '',
  `auto_commission_coin`  int(10) NOT NULL DEFAULT '0' COMMENT '',
  `tiptype` tinyint(1) NOT NULL DEFAULT '1' COMMENT '',
  `tipbtn` tinyint(1) NOT NULL DEFAULT '1' COMMENT '',
  `tipqrcode` varchar(500) DEFAULT '',
  `kefuqrcode` varchar(500) DEFAULT '',
  `operator_pwd` varchar(50) DEFAULT '',
  `apiclient_cert` tinyint(1) NOT NULL DEFAULT '0' COMMENT '',
  `apiclient_key` tinyint(1) NOT NULL DEFAULT '0' COMMENT '',
  `rootca` tinyint(1) NOT NULL DEFAULT '0' COMMENT '',
  `share_title` varchar(200) DEFAULT '',
  `share_desc` varchar(300) DEFAULT '',
  `share_image` varchar(500) DEFAULT '',
  `follow_url` varchar(500) DEFAULT '',
  `follow_title` varchar(500) DEFAULT '',
  `follow_desc` varchar(500) DEFAULT '',
  `follow_logo` varchar(500) DEFAULT '',
  `site_logo` varchar(500) DEFAULT '',
  `isneedfollow` tinyint(1) DEFAULT '0',
  `statistics` text NOT NULL DEFAULT '',
  `visit` int(10) DEFAULT '0',
  `dateline` int(10) DEFAULT '0',
  `style_base` varchar(20) NOT NULL DEFAULT '' COMMENT '',
  `style_list_btn1` varchar(20) NOT NULL DEFAULT '' COMMENT '',
  `style_list_btn2` varchar(20) NOT NULL DEFAULT '' COMMENT '',
  `style_list_btn3` varchar(20) NOT NULL DEFAULT '' COMMENT '',
  `style_list_base` varchar(20) NOT NULL DEFAULT '' COMMENT '',
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `ims_weisrc_dish_businesslog` (
  `id` int(10) NOT NULL AUTO_INCREMENT,
  `weid` int(10) unsigned NOT NULL DEFAULT '0',
  `storeid` int(10) unsigned NOT NULL DEFAULT '0',
  `uid` int(10) unsigned NOT NULL,
  `dining_mode` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '类型1店内2外卖3预定4快餐',
  `business_type` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '',
  `price` decimal(10,2) default '0.00' COMMENT '申请金额',
  `charges` decimal(10,2) default '0.00' COMMENT '手续费',
  `successprice` decimal(10,2) default '0.00' COMMENT '到帐金额',
  `haveprice` decimal(10,2) default '0.00' COMMENT '已申请总金额',
  `totalprice` decimal(10,2) default '0.00' COMMENT '当时可总金额',
  `trade_no` varchar(200) DEFAULT '0' COMMENT '',
  `payment_no` varchar(200) DEFAULT '0' COMMENT '',
  `result` varchar(1000) DEFAULT '0' COMMENT '',
  `reason` varchar(1000) DEFAULT '0' COMMENT '',
  `status` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '',
  `handletime` int(10) DEFAULT '0' COMMENT '处理时间',
  `dateline` int(10) DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `ims_weisrc_dish_cashlog` (
  `id` int(10) NOT NULL AUTO_INCREMENT,
  `weid` int(10) unsigned NOT NULL DEFAULT '0',
  `storeid` int(10) unsigned NOT NULL DEFAULT '0',
  `from_user` varchar(200) DEFAULT '' COMMENT '',
  `logtype` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '日志类型1佣金2配送佣金',
  `type` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '类型1微信2余额',
  `price` decimal(10,2) default '0.00' COMMENT '申请金额',
  `charges` decimal(10,2) default '0.00' COMMENT '手续费',
  `successprice` decimal(10,2) default '0.00' COMMENT '到帐金额',
  `totalprice` decimal(10,2) default '0.00' COMMENT '余额',
  `trade_no` varchar(200) DEFAULT '0' COMMENT '',
  `payment_no` varchar(200) DEFAULT '0' COMMENT '',
  `remark` varchar(1000) DEFAULT '0' COMMENT '',
  `status` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '',
  `handletime` int(10) DEFAULT '0' COMMENT '处理时间',
  `dateline` int(10) DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `ims_weisrc_dish_sms_setting` (
  `id` int(10) NOT NULL AUTO_INCREMENT,
  `weid` int(10) unsigned NOT NULL,
  `storeid` int(10) unsigned NOT NULL,
  `sms_enable` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '开启短信提醒',
  `sms_verify_enable` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '开启短信验证提醒',
  `sms_username` varchar(20) DEFAULT '' COMMENT '平台帐号',
  `sms_pwd` varchar(20) DEFAULT '' COMMENT '平台密码',
  `sms_mobile` varchar(20) DEFAULT '' COMMENT '商户接收短信手机',
  `sms_verify_tpl` varchar(120) DEFAULT '' COMMENT '验证短信模板',
  `sms_business_tpl` varchar(120) DEFAULT '' COMMENT '商户短信模板',
  `sms_user_tpl` varchar(120) DEFAULT '' COMMENT '用户短信模板',
  `dateline` int(10) DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `ims_weisrc_dish_store_setting` (
  `id` int(10) NOT NULL AUTO_INCREMENT,
  `weid` int(10) unsigned NOT NULL,
  `storeid` int(10) unsigned NOT NULL,
  `order_enable` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '订餐开启',
  `dateline` int(10) DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `ims_weisrc_dish_mealtime` (
  `id` int(10) NOT NULL AUTO_INCREMENT,
  `weid` int(10) unsigned NOT NULL,
  `storeid` int(10) unsigned NOT NULL,
  `begintime` varchar(20) DEFAULT '09:00' COMMENT '开始时间',
  `endtime` varchar(20) DEFAULT '18:00' COMMENT '结束时间',
  `status` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '是否开启',
  `dateline` int(10) DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `ims_weisrc_dish_dinnertime` (
  `id` int(10) NOT NULL AUTO_INCREMENT,
  `weid` int(10) unsigned NOT NULL,
  `storeid` int(10) unsigned NOT NULL,
  `begintime` varchar(20) DEFAULT '09:00' COMMENT '开始时间',
  `dateline` int(10) DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `ims_weisrc_dish_deliverytime` (
  `id` int(10) NOT NULL AUTO_INCREMENT,
  `weid` int(10) unsigned NOT NULL,
  `storeid` int(10) unsigned NOT NULL,
  `begintime` varchar(20) DEFAULT '09:00' COMMENT '开始时间',
  `endtime` varchar(20) DEFAULT '18:00' COMMENT '结束时间',
  `price` decimal(10,2) DEFAULT '0.00',
  `dateline` int(10) DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `ims_weisrc_dish_distance` (
  `id` int(10) NOT NULL AUTO_INCREMENT,
  `weid` int(10) unsigned NOT NULL,
  `storeid` int(10) unsigned NOT NULL,
  `begindistance` int(10) unsigned NOT NULL,
  `enddistance` int(10) unsigned NOT NULL,
  `sendingprice` decimal(10,2) DEFAULT '0.00' COMMENT '起送价格',
  `dispatchprice` decimal(10,2) DEFAULT '0.00',
  `freeprice` decimal(10,2) DEFAULT '0.00',
  `dateline` int(10) DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `ims_weisrc_dish_tables_seat` (
  `id` int(10) NOT NULL AUTO_INCREMENT,
  `weid` int(10) unsigned NOT NULL,
  `storeid` int(10) unsigned NOT NULL,
  `tablesid` int(10) unsigned NOT NULL,
  `title` varchar(50) NOT NULL DEFAULT '' COMMENT '名称',
  `dateline` int(10) DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `ims_weisrc_dish_stores` (
  `id` int(10) NOT NULL AUTO_INCREMENT,
  `weid` int(10) NOT NULL DEFAULT '0' COMMENT '公众号id',
  `from_user` varchar(200) NOT NULL DEFAULT '' COMMENT '',
  `areaid` int(10) NOT NULL DEFAULT '0' COMMENT '区域id',
  `schoolid` int(10) NOT NULL DEFAULT '0' COMMENT '学校id',
  `deliverytime` int(10) NOT NULL DEFAULT '0' COMMENT '配送时间',
  `typeid` int(10) NOT NULL DEFAULT '0' COMMENT '商家类型',
  `default_jump` tinyint(2) NOT NULL DEFAULT '1' COMMENT '默认类型',
  `default_jump_url` varchar(500) NOT NULL DEFAULT '' COMMENT '默认链接',
  `title` varchar(50) NOT NULL DEFAULT '' COMMENT '名称',
  `biz` varchar(50) NOT NULL DEFAULT '' COMMENT 'BIZ',
  `logo` varchar(500) NOT NULL DEFAULT '' COMMENT '商家logo',
  `info` varchar(1000) NOT NULL DEFAULT '' COMMENT '简短描述',
  `content` text NOT NULL COMMENT '简介',
  `thumbs` text NOT NULL COMMENT '',
  `announce` varchar(1000) NOT NULL DEFAULT '' COMMENT '公告通知',
  `listinfo` varchar(1000) NOT NULL DEFAULT '用餐高峰期请提前下单！' COMMENT '',
  `reservation_announce` varchar(1000) NOT NULL DEFAULT '' COMMENT '预定公告',
  `remarkinfo` varchar(1000) DEFAULT '可输入口味偏好要求(选填)' COMMENT '',
  `tel` varchar(20) NOT NULL DEFAULT '' COMMENT '联系电话',
  `address` varchar(200) DEFAULT '' COMMENT '地址',
  `qq` varchar(20) DEFAULT '' COMMENT '',
  `weixin` varchar(20) DEFAULT '' COMMENT '',
  `place` varchar(200) NOT NULL DEFAULT '',
  `lat` decimal(18,10) NOT NULL DEFAULT '0.0000000000' COMMENT '经度',
  `lng` decimal(18,10) NOT NULL DEFAULT '0.0000000000' COMMENT '纬度',
  `password` varchar(20) NOT NULL DEFAULT '' COMMENT '登录密码',
  `hours` varchar(200) NOT NULL DEFAULT '' COMMENT '营业时间',
  `recharging_password` varchar(20) NOT NULL DEFAULT '' COMMENT '充值密码',
  `thumb_url` varchar(1000) DEFAULT NULL,
  `enable_wifi` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '是否有wifi',
  `enable_card` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '是否能刷卡',
  `enable_room` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '是否有包厢',
  `enable_park` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '是否有停车',
  `is_locktables` tinyint(1) NOT NULL DEFAULT '0',
  `is_hasten` tinyint(1) NOT NULL DEFAULT '0',
  `is_dispatcharea` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否启用配送区域',
  `is_fengniao_area` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否启用蜂鸟配送区域',
  `is_brand` tinyint(1) NOT NULL DEFAULT '0' COMMENT '品牌商家',
  `is_sys_delivery` tinyint(1) NOT NULL DEFAULT '1' COMMENT '平台配送',
  `brandname` varchar(20) DEFAULT '品牌' COMMENT '',
  `is_card` tinyint(1) NOT NULL DEFAULT '0' COMMENT '',
  `is_wxapp_check` tinyint(1) NOT NULL DEFAULT '0' COMMENT '',
  `card_tilte` varchar(50) DEFAULT '' COMMENT '',
  `card_rule` text NOT NULL COMMENT '',
  `is_meal_pay_confirm` tinyint(1) NOT NULL DEFAULT '0' COMMENT '店内点餐在线支付是否需要确认',
  `is_hot` tinyint(1) NOT NULL DEFAULT '0' COMMENT '搜索页显示',
  `is_rest` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否休息中',
  `is_show` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否在手机端显示',
  `is_list` tinyint(1) NOT NULL DEFAULT '1' COMMENT '是否在列表显示',
  `is_sms` tinyint(1) NOT NULL DEFAULT '0',
  `is_hour` tinyint(1) NOT NULL DEFAULT '0',
  `is_add_dish` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否加菜',
  `is_newlimitprice` tinyint(1) NOT NULL DEFAULT '0' COMMENT '新顾客满减',
  `is_oldlimitprice` tinyint(1) NOT NULL DEFAULT '0' COMMENT '老顾客满减',
  `is_add_order` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否加单',
  `is_meal` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否店内点餐',
  `is_delivery` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否外卖订餐',
  `is_snack` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否支持快餐',
  `is_reservation` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否支持预定',
  `is_queue` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否支持排队',
  `is_intelligent` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否支持套餐',
  `is_savewine` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否支持寄存',
  `is_shouyin` tinyint(1) NOT NULL DEFAULT '0' COMMENT '',
  `is_fengniao` tinyint(1) NOT NULL DEFAULT '0' COMMENT '',
  `is_operator1` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否支持呼叫服务员',
  `is_operator2` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否支持打包',
  `is_business` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否支持子商户支付',
  `business_id` int(10) NOT NULL DEFAULT '0' COMMENT '子商户活动ID',
  `is_check_user` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否用户审核',
  `is_bank_pay` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否支持银行支付',
  `is_delivery_distance` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否支持配送距离',
  `is_delivery_time` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否特殊时间价格',
  `is_delivery_mode1` tinyint(1) NOT NULL DEFAULT '1' COMMENT '',
  `is_delivery_mode2` tinyint(1) NOT NULL DEFAULT '1' COMMENT '',
  `is_more_meal` tinyint(1) NOT NULL DEFAULT '1' COMMENT '',
  `is_jxkj_unipay` int(1) default '0',
  `jxkj_pay_id` int(10) default '0',
  `jxkj_pay_name` varchar(50) NOT NULL DEFAULT '万融收银',
  `bank_pay_id` int(10) NOT NULL DEFAULT '0' COMMENT '银行活动ID',
  `is_default_givecredit` tinyint(1) NOT NULL DEFAULT '1' COMMENT '默认1,自定义2',
  `givecredit` int(10) NOT NULL DEFAULT '0' COMMENT '',
  `is_vtiny_bankpay` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否支持银行支付',
  `vtiny_bankpay_id` int(10) NOT NULL DEFAULT '0' COMMENT '银行活动ID',
  `vtiny_bankpay_url` varchar(500) NOT NULL DEFAULT '' COMMENT '链接',
  `is_auto_confirm` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否自动确认订单',
  `is_order_autoconfirm` tinyint(1) NOT NULL DEFAULT '0' COMMENT '',
  `notice_space_time` int(10) DEFAULT '300',
  `coupon_title1` varchar(100) NOT NULL DEFAULT '' COMMENT '优惠名称',
  `coupon_link1` varchar(200) NOT NULL DEFAULT '' COMMENT '优惠链接',
  `coupon_title2` varchar(100) NOT NULL DEFAULT '' COMMENT '优惠名称',
  `coupon_link2` varchar(200) NOT NULL DEFAULT '' COMMENT '优惠链接',
  `coupon_title3` varchar(100) NOT NULL DEFAULT '' COMMENT '优惠名称',
  `coupon_link3` varchar(200) NOT NULL DEFAULT '' COMMENT '优惠链接',
  `btn_reservation` varchar(100) NOT NULL DEFAULT '预定' COMMENT '预定按钮',
  `btn_eat` varchar(100) NOT NULL DEFAULT '点菜' COMMENT '点菜按钮',
  `btn_delivery` varchar(100) NOT NULL DEFAULT '外卖' COMMENT '外卖按钮',
  `btn_snack` varchar(100) NOT NULL DEFAULT '快餐' COMMENT '快餐按钮',
  `btn_queue` varchar(100) NOT NULL DEFAULT '排队' COMMENT '排队按钮',
  `btn_intelligent` varchar(100) NOT NULL DEFAULT '套餐' COMMENT '套餐按钮',
  `btn_shouyin` varchar(100) NOT NULL DEFAULT '收银' COMMENT '',
  `is_reservation_dish` tinyint(1) NOT NULL DEFAULT '1' COMMENT '',
  `reservation_days` int(10) NOT NULL DEFAULT '7' COMMENT '预订天数',
  `kefu_qrcode` varchar(500) NOT NULL DEFAULT '' COMMENT '',
  `begintime` varchar(20) DEFAULT '09:00' COMMENT '开始时间',
  `endtime` varchar(20) DEFAULT '18:00' COMMENT '结束时间',
  `begintime1` varchar(20) DEFAULT '09:00' COMMENT '开始时间',
  `endtime1` varchar(20) DEFAULT '18:00' COMMENT '结束时间',
  `begintime2` varchar(20) DEFAULT '09:00' COMMENT '开始时间',
  `endtime2` varchar(20) DEFAULT '18:00' COMMENT '结束时间',
  `delivery_isnot_today` tinyint(1) NOT NULL DEFAULT '0' COMMENT '',
  `delivery_within_days` int(10) NOT NULL DEFAULT '0' COMMENT '允许提前几天点外卖',
  `delivery_radius` decimal(18,1) NOT NULL DEFAULT '0.0' COMMENT '半径',
  `not_in_delivery_radius` tinyint(1) NOT NULL DEFAULT '1' COMMENT '在配送半径之外是否允许下单',
  `sendingprice` varchar(10) NOT NULL DEFAULT '' COMMENT '起送价格',
  `dispatchprice` decimal(10,2) DEFAULT '0.00',
  `freeprice` decimal(10,2) DEFAULT '0.00',
  `consume` varchar(20) NOT NULL COMMENT '人均消费',
  `wechat` tinyint(1) NOT NULL DEFAULT '1' COMMENT '',
  `alipay` tinyint(1) NOT NULL DEFAULT '1' COMMENT '',
  `credit` tinyint(1) NOT NULL DEFAULT '1' COMMENT '',
  `is_speaker` tinyint(1) NOT NULL DEFAULT '1' COMMENT '',
  `delivery` tinyint(1) NOT NULL DEFAULT '1' COMMENT '',
  `is_reservation_today` tinyint(1) NOT NULL DEFAULT '1' COMMENT '',
  `reservation_tip` varchar(200) NOT NULL DEFAULT '请输入备注，人数口味等等（可不填）' COMMENT '',
  `reservation_wechat` tinyint(1) NOT NULL DEFAULT '1' COMMENT '',
  `reservation_alipay` tinyint(1) NOT NULL DEFAULT '1' COMMENT '',
  `reservation_credit` tinyint(1) NOT NULL DEFAULT '1' COMMENT '',
  `reservation_delivery` tinyint(1) NOT NULL DEFAULT '1' COMMENT '',
  `level` tinyint(1) NOT NULL DEFAULT '1' COMMENT '级别',
  `screen_mode` tinyint(1) NOT NULL DEFAULT '1',
  `screen_title` varchar(200) NOT NULL DEFAULT '' COMMENT '',
  `screen_bg` varchar(500) NOT NULL DEFAULT '' COMMENT '',
  `screen_bottom` varchar(200) NOT NULL DEFAULT '' COMMENT '',
  `displayorder` tinyint(3) NOT NULL DEFAULT '0',
  `updatetime` int(10) NOT NULL DEFAULT '0',
  `dateline` int(10) NOT NULL DEFAULT '0',
  `business_type` tinyint(1) NOT NULL DEFAULT '0',
  `business_mobile` varchar(30) NOT NULL DEFAULT '' COMMENT '',
  `business_openid` varchar(200) NOT NULL DEFAULT '' COMMENT '',
  `business_username` varchar(200) NOT NULL DEFAULT '' COMMENT '',
  `business_alipay` varchar(200) NOT NULL DEFAULT '' COMMENT '',
  `business_wechat` varchar(200) NOT NULL DEFAULT '' COMMENT '',
  `is_ld_wxserver` tinyint(1) NULL default NULL,
  `ld_wxserver_url` varchar(255) NULL default NULL,
  `is_default_rate` tinyint(1) NOT NULL DEFAULT '1' COMMENT '默认1,自定义2',
  `getcash_price` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '最低提现金额',
  `fee_rate` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '提现费率',
  `fee_min` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '提现手续费最低金额',
  `fee_max` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '提现手续费最高金额',
  `is_tea_money` tinyint(1) NOT NULL DEFAULT '0',
  `tea_money` decimal(10,2) DEFAULT '0.00',
  `tea_tip` varchar(200) NOT NULL DEFAULT '' COMMENT '',
  `is_floor_money` tinyint(1) NOT NULL DEFAULT '0',
  `floor_money` decimal(10,2) DEFAULT '0.00',
  `floor_tip` varchar(200) NOT NULL DEFAULT '' COMMENT '',
  `deleted` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `is_delivery_nowtime` tinyint(1) NOT NULL DEFAULT '1' COMMENT '',
  `is_jueqi_ymf` tinyint(1) NOT NULL DEFAULT '0' COMMENT '',
  `jueqi_host` varchar(200) NOT NULL DEFAULT '' COMMENT '',
  `jueqi_customerId` varchar(200) NOT NULL DEFAULT '' COMMENT '',
  `jueqi_secret` varchar(200) NOT NULL DEFAULT '' COMMENT '',
  `is_order_tip` tinyint(1) NOT NULL DEFAULT '0' COMMENT '',
  `default_user_count` int(10) unsigned NOT NULL DEFAULT '5' COMMENT '默认的用餐人数',
  `btn_coupon_type` tinyint(1) NOT NULL DEFAULT '0' COMMENT '',
  `btn_coupon_url` varchar(500) NOT NULL DEFAULT '' COMMENT '',
  `btn_coupon_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '',
  `btn_coupon_price` varchar(50) NOT NULL DEFAULT '15元' COMMENT '',
  `btn_coupon_title` varchar(50) NOT NULL DEFAULT '商家优惠券' COMMENT '',
  `btn_coupon_desc` varchar(50) NOT NULL DEFAULT '消费满100元可用' COMMENT '',
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `ims_weisrc_dish_ad` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `uniacid` int(10) unsigned NOT NULL,
  `schoolid` int(10) NOT NULL DEFAULT '0' COMMENT '学校id',
  `title` varchar(100) NOT NULL DEFAULT '',
  `url` varchar(200) NOT NULL DEFAULT '',
  `thumb` varchar(500) NOT NULL DEFAULT '',
  `position` tinyint(1) NOT NULL DEFAULT '1' COMMENT '1:首页,2:商家页',
  `starttime` int(10) NOT NULL DEFAULT '0' COMMENT '开始时间',
  `endtime` int(10) NOT NULL DEFAULT '0' COMMENT '结束时间',
  `displayorder` int(10) unsigned NOT NULL DEFAULT '0',
  `status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '是否显示',
  `dateline` int(10) unsigned NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `ims_weisrc_dish_useraddress` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `weid` int(10) unsigned NOT NULL,
  `from_user` varchar(50) NOT NULL DEFAULT '',
  `realname` varchar(20) NOT NULL DEFAULT '',
  `mobile` varchar(20) NOT NULL DEFAULT '',
  `address` varchar(300) NOT NULL DEFAULT '',
  `doorplate` varchar(300) NOT NULL DEFAULT '',
  `gender` tinyint(1) NOT NULL DEFAULT '1',
  `isdefault` tinyint(1) NOT NULL DEFAULT '0',
  `lat` decimal(18,10) NOT NULL DEFAULT '0.0000000000' COMMENT '经度',
  `lng` decimal(18,10) NOT NULL DEFAULT '0.0000000000' COMMENT '纬度',
  `dateline` int(10) NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `ims_weisrc_dish_collection` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `weid` int(10) unsigned NOT NULL,
  `from_user` varchar(50) NOT NULL,
  `storeid` int(10) unsigned NOT NULL,
  `dateline` int(10) NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `ims_weisrc_dish_type` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `weid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '所属帐号',
  `schoolid` int(10) NOT NULL DEFAULT '0' COMMENT '学校id',
  `name` varchar(50) NOT NULL COMMENT '类型名称',
  `url` varchar(200) NOT NULL DEFAULT '' COMMENT '链接',
  `thumb` varchar(500) NOT NULL DEFAULT '' COMMENT '图片',
  `parentid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '上级分类ID,0为第一级',
  `displayorder` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '排序',
  `dateline` int(10) unsigned NOT NULL DEFAULT '0',
  `status` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '状态',
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `ims_weisrc_dish_template` (
  `id` int(10) NOT NULL AUTO_INCREMENT,
  `weid` int(10) NOT NULL DEFAULT '0' COMMENT '',
  `template_name` varchar(50) NOT NULL DEFAULT 'style1',
  PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

CREATE TABLE if not exists `ims_weisrc_dish_goods_option` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `goodsid` int(10) DEFAULT '0',
  `type` int(10) DEFAULT '0',
  `start` varchar(50) DEFAULT '',
  `title` varchar(50) DEFAULT '',
  `price` decimal(10,2) DEFAULT '0.00',
  `stock` int(11) DEFAULT '0',
  `displayorder` int(11) DEFAULT '0',
  `specs` text,
  PRIMARY KEY (`id`),
  KEY `indx_goodsid` (`goodsid`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

CREATE TABLE if not exists `ims_weisrc_dish_fengniao` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `weid` int(10) unsigned NOT NULL,
  `storeid` int(10) unsigned NOT NULL,
  `orderid` int(11) DEFAULT '0' COMMENT '',
  `open_order_code` varchar(200) DEFAULT '' COMMENT '蜂鸟配送开放平台返回的订单号',
  `partner_order_code` varchar(200) DEFAULT '' COMMENT '商户自己的订单号',
  `order_status` int(11) DEFAULT '0' COMMENT '状态码',
  `push_time` int(11) DEFAULT '0' COMMENT '状态推送时间(毫秒)',
  `carrier_driver_name` varchar(200) DEFAULT '' COMMENT '蜂鸟配送员姓名',
  `carrier_driver_phone` varchar(200) DEFAULT '' COMMENT '蜂鸟配送员电话',
  `description` varchar(200) DEFAULT '' COMMENT '描述信息',
  `address` varchar(200) DEFAULT '' COMMENT '定点次日达服务独有的字段: 微仓地址',
  `latitude` decimal(18,10) NOT NULL DEFAULT '0.0000000000' COMMENT '定点次日达服务独有的字段: 微仓纬度',
  `longitude` decimal(18,10) NOT NULL DEFAULT '0.0000000000' COMMENT '定点次日达服务独有的字段: 微仓经度',
  `cancel_reason` int(11) DEFAULT '0' COMMENT '订单取消原因. 1:用户取消, 2:商家取消',
  `error_code` varchar(200) DEFAULT '' COMMENT '错误编码',
  PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
";
pdo_run($sql);
//open_order_code	string	蜂鸟配送开放平台返回的订单号
//partner_order_code	string	商户自己的订单号
//order_status	int	状态码
//push_time	long	状态推送时间(毫秒)
//carrier_driver_name	string	蜂鸟配送员姓名
//carrier_driver_phone	string	蜂鸟配送员电话
//description	string	描述信息
//address	string	定点次日达服务独有的字段: 微仓地址
//latitude	long	定点次日达服务独有的字段: 微仓纬度
//longitude	long	定点次日达服务独有的字段: 微仓经度
//cancel_reason	int	订单取消原因. 1:用户取消, 2:商家取消
//error_code	string	错误编码

//CREATE TABLE if not exists `ims_weisrc_dish_goods_option` (
//`id` int(11) NOT NULL AUTO_INCREMENT,
//  `goodsid` int(10) DEFAULT '0',
//  `title` varchar(50) DEFAULT '',
//  `price` decimal(10,2) DEFAULT '0.00',
//  `stock` int(11) DEFAULT '0',
//  `displayorder` int(11) DEFAULT '0',
//  `specs` text,
//  PRIMARY KEY (`id`),
//  KEY `indx_goodsid` (`goodsid`)
//) ENGINE=MyISAM DEFAULT CHARSET=utf8;